//
// Created by zlxx on 2022/10/21.
//
#pragma once
#ifndef MINIDB_TUPLEVALUE_H
#define MINIDB_TUPLEVALUE_H
#include <vector>
#include <string>
#include "expression.h"
#include "common/log/log.h"
#include "tuple_cell.h"
#include "storage/record/record.h"

class Record;
class Table;
class FieldExpr;

class TupleValue {
public:
  TupleValue() = default;
  virtual ~TupleValue() {
  }
  int cell_num() const  {
    return field_exprs_.size();
  }
  RC cell_at(int index, TupleCell &cell)  const;
  RC find_cell(const Field &field, TupleCell &cell) const ;
  void set_schema(const Table *table, const std::vector<FieldMeta> *fields) ;
  const Table *table() const;

  Record record();
  void set_record(const Record& record);


private:
  std::vector<std::string> show_names_;
  //! 0是系统列
  std::vector<FieldExpr> field_exprs_;
  Record record_;
  const Table *table_{};
};
#endif  // MINIDB_TUPLEVALUE_H
